<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <!--  <script src="https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js"></script>-->
    <script src="vue.js"></script>
</head>
<body>
4.复选框
<div id="app">
    <input type="checkbox" v-model="checked">
    当前值:{{checked}}
    <input type="checkbox" v-model="checked1">
    当前值:{{checked1}}
    <input type="checkbox" v-model="checked2">
    当前值: {{checked2}}
    <br>
    全选功能： <input type="checkbox" v-model="checkedAll" @change="checkedAllfun">
    是否全选： {{checkedAll}}
</div>
<script>
    let vm = new Vue({
        el: "#app",
        data() {
            return {
                checked:false,
                checked1:false,
                checked2:false,
                checkedAll:false
            }
        },
        methods: {
            //修改其他复选框的值
            checkedAllfun(){
                this.checked = this.checkedAll;
                this.checked1 = this.checkedAll;
                this.checked2 = this.checkedAll;
            }
        },
    });
</script>
</body>
</html>
